<%inherit file="base.html"/>

<%def name="head()">
<script>
    function deleteRadius(radius_id)
    {
        if(confirm("确认删除吗？"))
        {
            window.location.href = "/radius/delete?radius_id="+radius_id;
        }
    }

</script>
</%def>

<%def name="body()">
<section class="content">
    <div class="box box-primary">
        <div class="box-header">
            <i class="fa fa-sitemap"></i>
            <h3 class="box-title">Radius节点列表</h3>
        </div>
        <div class="box-body">
            <div class="container">
                % if permit.match(current_user.username,'/radius/add'):
                <div class="pull-right bottom10">
                    <a href="/radius/add" class="btn btn-sm btn-info">新增Radius服务器</a>
                </div>
                % endif
                <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>Radius名称</th>
                            <th>Radius地址</th>
                            <th>共享密钥</th>
                            <th>认证端口</th>
                            <th>计费端口</th>
                            <th>连接状态</th>
                        </tr>
                    </thead>
                    <tbody>
                        % for item in radius_list:
                            <tr>
                                <td>${item.name}</td>
                                <td>${item.ip_addr}</td>
                                <td>${item.secret}</td>
                                <td>${item.auth_port}</td>
                                <td>${item.acct_port}</td>
                                <td>${utils.is_connect(item.last_check) and '<span class="label label-success">连接</span>' or '<span class="label label-default">失联</span>'}
                                </td>
                                <td>
                                    % if permit.match(current_user.username,'/radius/update'):
                                    <a class="opt-btn btn-default" href="/radius/update?radius_id=${item.id}">修改</a>
                                    % endif
                                    % if permit.match(current_user.username,'/radius/delete'):
                                    <a class="opt-btn btn-default" href="javascript:deleteRadius('${item.id}')">删除</a>
                                    % endif
                                </td>
                            </tr>
                        % endfor
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</section>
</%def>